package com.nmsl.masterdocker.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.nmsl.common.annotation.Log;
import com.nmsl.common.core.controller.BaseController;
import com.nmsl.common.core.domain.AjaxResult;
import com.nmsl.common.enums.BusinessType;
import com.nmsl.masterdocker.domain.DiseaseRecordLog;
import com.nmsl.masterdocker.service.IDiseaseRecordLogService;
import com.nmsl.common.utils.poi.ExcelUtil;
import com.nmsl.common.core.page.TableDataInfo;

/**
 * 病人病情记录日志Controller
 * 
 * @author ruoyi
 * @date 2025-02-17
 */
@RestController
@RequestMapping("/masterdocker/masterdockerlog")
public class DiseaseRecordLogController extends BaseController
{
    @Autowired
    private IDiseaseRecordLogService diseaseRecordLogService;

    /**
     * 查询病人病情记录日志列表
     */
    @PreAuthorize("@ss.hasPermi('masterdocker:masterdockerlog:list')")
    @GetMapping("/list")
    public TableDataInfo list(DiseaseRecordLog diseaseRecordLog)
    {
        startPage();
        List<DiseaseRecordLog> list = diseaseRecordLogService.selectDiseaseRecordLogList(diseaseRecordLog);
        return getDataTable(list);
    }

    /**
     * 导出病人病情记录日志列表
     */
    @PreAuthorize("@ss.hasPermi('masterdocker:masterdockerlog:export')")
    @Log(title = "病人病情记录日志", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, DiseaseRecordLog diseaseRecordLog)
    {
        List<DiseaseRecordLog> list = diseaseRecordLogService.selectDiseaseRecordLogList(diseaseRecordLog);
        ExcelUtil<DiseaseRecordLog> util = new ExcelUtil<DiseaseRecordLog>(DiseaseRecordLog.class);
        util.exportExcel(response, list, "病人病情记录日志数据");
    }

    /**
     * 获取病人病情记录日志详细信息
     */
    @PreAuthorize("@ss.hasPermi('masterdocker:masterdockerlog:query')")
    @GetMapping(value = "/{logId}")
    public AjaxResult getInfo(@PathVariable("logId") Long logId)
    {
        return success(diseaseRecordLogService.selectDiseaseRecordLogByLogId(logId));
    }

    /**
     * 新增病人病情记录日志
     */
    @PreAuthorize("@ss.hasPermi('masterdocker:masterdockerlog:add')")
    @Log(title = "病人病情记录日志", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody DiseaseRecordLog diseaseRecordLog)
    {
        return toAjax(diseaseRecordLogService.insertDiseaseRecordLog(diseaseRecordLog));
    }

    /**
     * 修改病人病情记录日志
     */
    @PreAuthorize("@ss.hasPermi('masterdocker:masterdockerlog:edit')")
    @Log(title = "病人病情记录日志", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody DiseaseRecordLog diseaseRecordLog)
    {
        return toAjax(diseaseRecordLogService.updateDiseaseRecordLog(diseaseRecordLog));
    }

    /**
     * 删除病人病情记录日志
     */
    @PreAuthorize("@ss.hasPermi('masterdocker:masterdockerlog:remove')")
    @Log(title = "病人病情记录日志", businessType = BusinessType.DELETE)
	@DeleteMapping("/{logIds}")
    public AjaxResult remove(@PathVariable Long[] logIds)
    {
        return toAjax(diseaseRecordLogService.deleteDiseaseRecordLogByLogIds(logIds));
    }
}
